﻿<?php

require_once("../lib/fonctions_requete_sql.php");
$bdd = new PDO('mysql:host=localhost;dbname=brin_de_soleil', 'root', '');
$bdd->exec('SET NAMES utf8');	// Pour les problèmes d'accent
$bdd->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING );	// pour afficher les warning de mysql


$id_etablissement = select_id_etablissement($bdd,$_POST['adresse'],$_POST['codepostal'],$_POST['ville_prospect'],$_POST['tel1'],$_POST['tel2'],$_POST['fax'],$_POST['email'],"", $_POST['etablissement']);
	
$req = $bdd->prepare('INSERT INTO usager(id_etablissement,matricule, date_creation, qualite, num_poste, region, departement, classification, num_salaries, nb_particip_concerne, potentiel_particip, nbbrochure, date_hiver, date_inscription_hiver, date_ete, date_inscription_ete, fonctionnement_collect)
VALUES (:id_etablissement,:matricule, :date, :qualite, :numposte, :region, :dept, :classification, :nbsal, :nbpartconcerne, :potentielpart, :nbbrochures, :datehiver, :dateinscr_hiver, :dateete, :dateinscr_ete, :facturation_area)');
$req->execute(array(
	'id_etablissement' => $id_etablissement,
	'matricule' => $_POST['matricule'],
	'date' => $_POST['date'],
	'qualite' => $_POST['qualite'],
	'numposte' => $_POST['numposte'],
	'region' => $_POST['region'],
	'dept' => $_POST['dept'],
	'classification' => $_POST['classification'],
	'nbsal' => $_POST['nbsal'],
	'nbpartconcerne' => $_POST['nbpartconcerne'],
	'potentielpart' => $_POST['potentielpart'],
	'nbbrochures' => $_POST['nbbrochures'],
	'datehiver' => $_POST['datehiver'],
	'dateinscr_hiver' => $_POST['dateinscr_hiver'],
	'dateete' => $_POST['dateete'],
	'dateinscr_ete' => $_POST['dateinscr_ete'],
	'facturation_area' => $_POST['facturation_area'],
	));	

?>

